package net.tarine.gastronomi.client;

import net.tarine.gastronomi.client.widgets.GlassPanel;

public class WaitSingleton {

	private static WaitSingleton instance = null;
	private static GlassPanel glassPanel;
	private static int countWaitInProgress;
	
	private WaitSingleton() {
		glassPanel = new GlassPanel();
		countWaitInProgress = 0;
	}
	
	public static WaitSingleton get() {
		if (instance == null) {
			instance = new WaitSingleton();
		}
		return instance;
	}
	
	public void start() {
    	if (countWaitInProgress == 0) {
    		glassPanel.show();
    	}    	
    	countWaitInProgress +=1;
	}
	
	public void stop() {
    	if (countWaitInProgress == 1) {
    		glassPanel.hide();
    	}
    	countWaitInProgress -=1;
	}
}
